<template>
  <view class="my-title">
    <view class="my-title-img">
      <image src="../../static/img/touxiang2.png" mode="" v-if="show"></image>
      <image :src="yonghuwx.avatarUrl" mode="" v-else></image>
      <!-- <web-view src="https://www.baidu.com/"></web-view> -->
    </view>
    <view class="my-title-button" v-if="show"
      ><button plain="true" @click="login">立即登录</button></view
    >
    <view class="my-title-button" v-else
      ><text>{{ yonghuwx.nickName }}</text></view
    >
  </view>
</template>

<script>
export default {
  data() {
    return {
      // show: true
      // yonghuwx: []
    };
  },
  props: {
    yonghuwx: Object,
    show: {
      type: Boolean,
      default: true,
    },
  },
  methods: {
    login() {
      console.log("444");
      uni.navigateTo({
        url: "login",
        // success: (res) => {
        // },
        fail: (err) => {
          console.log(err);
        },
      });
      // uni.login({
      // 	provider: 'weixin',
      // 	success: function(loginRes) {
      // 		console.log(loginRes);
      //        uni.navigateTo({
      //            url: 'pages/login/login'
      //        });
      // 		// uni.getUserInfo({
      // 		// 	provider: 'weixin',
      // 		// 	success: function(infoRes) {
      // 		// 		this.yonghuwx = infoRes.userInfo;
      // 		// 		console.log(this.yonghuwx);
      // 		// 	}
      // 		// });

      // 	}
      // });
    },
  },
};
</script>

<style lang="scss">
@import "@/static/styles/mixin.scss";
.my-title {
  width: 100%;
  height: 220rpx;
  background-color: #56d998;
  display: flex;
  padding: 0 40rpx;
  box-sizing: border-box;
  .my-title-img {
    @include center;

    image {
      @include center;
      width: 110rpx;
      height: 110rpx;
      border-radius: 50%;
      background-color: #ffffff;
    }
  }
  .my-title-button {
    @include center;
    padding: 0 15rpx;
    button {
      border-radius: 30rpx;
      font-size: 24rpx;
      color: #20b1ff;
      width: 200rpx;
      // size: 10;
      height: 60rpx;
      @include center;
      background-color: #eaeaea;
      border: none;
    }
    text {
      padding: 0 20rpx;
    }
  }
}
</style>
